package com.oros.db;

import java.io.Serializable;

public class AENotNullIdValidator implements Serializable, AEValidator {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7693746583235996110L;
	private String[] columns;
	public AENotNullIdValidator(String[] columns)
	{
		this.columns = columns;
	}
	@Override
	public boolean isValid(AETableContainer parent, AERawItem item) {
		int n=columns.length;
		for(int i=0;i<n;i++)
		{
			Object a = item.getItemProperty(columns[i]).getValue();
			if (a==null) return false;
			if (a instanceof Integer && ((Integer)a).intValue()<=0) return false;
			if (a instanceof Long && ((Long)a).longValue()<=0) return false;
		}
		return true;
	}

}
